
//
// 130315 - AH - Created.
//

package org.japril.servlet;

/**
 * <p>
 *   Represents an authenticated web application user.
 * </p>
 * @author Arne Halvorsen (AH)
 */
public final class WebAppUser
{
  private String m_name="";
  
  private String m_logOutUrl="";
  
  /**
   * <p>
   *   Constructor.
   * </p>
   */
  public WebAppUser(){}
  
  /**
   * <p>
   *   Sets user's name.
   * </p>
   * @param name Name.
   * @return {@code this}.
   */
  public WebAppUser setName(String name)
  {
    m_name=(name==null) ? "" : name.trim();
    return this;
  }
  
  /**
   * <p>
   *   Gets name.
   * </p>
   * @return Return name or the empty string if not known.
   */
  public String getName(){ return m_name; }
  
  /**
   * <p>
   *   Sets URL that is link to logout user.
   * </p>
   * @param url URL.
   * @return {@code this}.
   */
  public WebAppUser setLogoutUrl(String url)
  {
    m_logOutUrl=(url==null) ? "" : url.trim();
    return this;
  }
  
  /**
   * <p>
   *   Gets URL that is link to logout user.
   * </p>
   * @return URL or empty string if not known.
   */
  public String getLogoutUrl(){ return m_logOutUrl; }
  
  @Override
  public String toString(){ return getName(); }
  
}
